#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 2e5 + 10;

int n, m;
vector<int> edge[N];
bool ok[N], vis[N];
int p[N], color[N], sz[N], nums0[N];

int find(int x){
    if(x != p[x]){
        p[x] = find(p[x]);
    }
    return p[x];
}

bool check(int u){
    vis[u] = true;

    for(int i = 0; i < edge[u].size(); i ++){
        int j = edge[u][i];
        if(vis[j]){
            if(color[u] == color[j]) return false;
        }else{
            color[j] = 1 - color[u];
            if(!check(j)) return false;
        }
    }
    return true;
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> m;
    for(int i = 0; i <= n; i ++) p[i] = i, sz[i] = 1;

    for(int i = 1, a, b; i <= m; i ++){
        cin >> a >> b;
        edge[a].push_back(b), edge[b].push_back(a);

        int fa = find(a), fb = find(b);
        if(fa != fb){
            sz[fb] += sz[fa];
            sz[fa] = 0;
            p[fa] = fb;
            
          // cout << "fb: " << fb << " " << sz[fb] << '\n';
          
        }
    }

    // for(int i = 1; i <= n; i ++){
    //     cout << sz[i] << " ";
    // }
    // cout << '\n';


    for(int i = 1; i <= n; i ++){
        if(!vis[i]){
            bool is2 = check(i);



            if(is2){
                int fa = find(i);
                ok[fa] = true;
            }else{
                cout << 0 << endl;
                return 0;
            }
        }
    }

    int cnt = 0;
    for(int i = 1; i <= n; i ++){
        int fa = find(i);
        if(ok[fa]) cnt ++;
        if(ok[fa] && color[i] == 0) nums0[fa] ++;
    }


    LL res = 0;
    for(int i = 1; i <= n; i ++){
        int fa = find(i);

        if(ok[fa]) res = res + (LL)cnt - sz[fa];
        if(ok[fa]){
            if(color[i] == 0){
                res = res + sz[fa] - nums0[fa] - edge[i].size();
            }else{
                res = res + nums0[fa] - edge[i].size();
            }
        }
    }


  //  cout << "cnt: " << cnt << " sz " << sz[find(3)] << '\n';

    cout << res / 2 << endl;







    return 0;
}